<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="width=device-width,initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
    <meta content="yes" name="apple-mobile-web-app-capable">
    <meta content="black" name="apple-mobile-web-app-status-bar-style">
    <meta content="telephone=no" name="format-detection">
    <title>渠道分成记录</title>
    <link rel="stylesheet" href="../style/base.css">
    <script src="https://cdn.bootcss.com/jquery/3.2.0/jquery.min.js"></script>
    <script src="../js/paramsTool.js"></script>
    <script src="../../js/layer.js"></script>

</head>
<style type="text/css">
    .top{width:100%; height:60px; line-height:60px; text-align:center; background:#36a2f9; color:#fff; font-size:18px;}
    .top #extract{position: absolute; right: 5px;top: 0px;font-size:14px; height: 60px; line-height: 60px; width: 100px;}
    .listnum1{background:#f7f7f7;width:100%;height:30px; line-height:30px;border-top:1px solid #ddd;border-bottom:1px solid #ddd;}
    .listnum1 .left{float:left;width:40%;color:#898989;margin-left:20px;font-size:14px;}
    /***战友团明细***/
    .infoline_bands{width:100%;height:88px;padding:1px 0;border-bottom: solid #f0efef 1px; display:block;background:#fff; font-weight:100;}
    .infoline_bands .infopic{width:25%; float:left;line-height:88px;  padding: 0 5px;}
    .infoline_bands .infopic img{width:40px; height:40px;border-radius:100%; border:1px solid #CCC;margin:3px 0 0 0px;}
    .infoline_bands .infotxt{float:left;width: 70%; text-align:left; margin-top: 7px ; line-height: 1.5; }
    .infoline_bands .infotxt .name{padding-top:5px;text-align:left; font-weight:bold; font-size:12px;float:left;overflow:hidden; color:#000;}
    .infoline_bands .infotxt .order{padding-top:5px;text-align:left; ; font-weight:bold; font-size:12px;float:left;overflow:hidden; color:#000;}
    .infoline_bands .infotxt .time{padding-top:5px; clear:both; min-height:18px;text-align:left; font-size:10px; float:left; font-weight:bold; overflow:hidden;}

</style>
<script>
    var host = window.location.origin;

    var params = queryString();
    var channel = params.channel;
    var openid = getCookie('disOpenid');// || 'o4AyEt2gypi_z981XBQzM5in0q_U';
//    var openid = getCookie('disOpenid') || 'o4AyEt2gypi_z981XBQzM5in0q_U';
    $('#extract').hide();
    if(openid == 'o4AyEt_EpmY83VE17bCOJ-t8MIEg' && openid == 'o4AyEt2gypi_z981XBQzM5in0q_U'){
        $('#extract').show();
    }


    if(!channel){
        alert('暂无权限!!!')
    }else {

        $(function () {

            if(openid != 'o4AyEt_EpmY83VE17bCOJ-t8MIEg' || openid != 'o4AyEt2gypi_z981XBQzM5in0q_U') $("#extract").show();

            $("#extract").click(function () {
                channel = 'popularize';
                channel += prompt("想查看的渠道编号", "");//将输入的内容赋给变量 name ，
                $("#band").empty();
                getData(channel);
            });

            getData(channel);

            function getData(channel){
                $.ajax({
                    url: host + "/listDisHistory",
                    type: "get",
                    dataType: 'json',
                    async: true,//请求是否异步，默认为异步，这也是ajax重要特性
                    cache: false,
                    headers: {"content-type": "application/json", "channel": channel},
                    success: function (data) {
                        if (data.code) {
                            alert('error:' + data.info);
                        } else {
                            var data = data.data;
//                            console.log('data:', JSON.stringify(data));
                            var coinTotal = 0;
                            var todUser = 0;
                            var payUser = 0;

                            for(var i = 0;i<data.length;i++){
                                coinTotal += data[i].dividedRmb*100;
                                var infoBan=$("<div></div>").addClass('infoline_bands');
                                var infopic=$("<div></div>").addClass('infopic').appendTo(infoBan);
                                var imgHead = $("<div style='color:#36a2f9; font-size: 12px; font-weight: 600; width:100%;float: left;'>金额: "+data[i].dividedNum/100+"</div>").appendTo(infopic);
                                var infotxt = $("<div></div>").addClass('infotxt').appendTo(infoBan);
                                var name = $("<div>渠道RMB:"+data[i].coinNum+"元</div>").appendTo(infotxt);
                                var order = $("<div> <label>充值金额:"+data[i].orderNum+"元</label>  <label>提现金额:"+data[i].cashNum+"元</label></div>").addClass('name').appendTo(infotxt);
                                var time = $("<div>结算时间:"+dateFormate(data[i].addDate)+"</div>").addClass('time').appendTo(infotxt);
                                infoBan.appendTo($('#band'));
                            }
                            $('#total').html(data.length);
                            $('#coinTotal').html(coinTotal/100);
                            $('#channelName').html(channel);

                        }
                    },
                    error: function() {
                        alert(
                                '获取数据失败,请重试!');
                    }
                });
            }

        });
    }

</script>
<body>
<!--顶部bar-->
<div class="top">
    分成总额 <label id="coinTotal" style="font-weight: 600">0</label> 元
    <div id="extract">查看其他渠道</div>
</div>
<!--顶部bar结束-->
<div class="listnum1">
    <div class="left">
        共 <label id="total" style="color:red;font-weight: 600">0</label> 条
    </div>
    <div class="right">
        渠道ID: <label id="channelName" style="color:red;font-weight: 600"></label>
    </div>
</div>
<div id="band">

</div>
</body>
</html>
